package org.iteam.xlz.manager.action.order;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.iteam.web.struts.action.AbstractModuleAction;
import org.iteam.web.struts.action.RestAction;
import org.iteam.xlz.core.entity.order.OrderInfo;
import org.iteam.xlz.core.service.order.OrderInfoService;
import org.iteam.xlz.core.service.order.SendService;

import com.opensymphony.xwork2.ModelDriven;

@SuppressWarnings("unchecked")
@Results({@Result(name="INDEX",type="freemarker",location="/WEB-INF/content/order/send/index.html"),
    @Result(name="EDIT",type="freemarker",location="/WEB-INF/content/order/send/edit.html")})
public class SendAction extends AbstractModuleAction<OrderInfo> implements RestAction,ModelDriven<OrderInfo>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4000407075322773426L;
	private final String PATH="/order/send";
	
	@Override
	public OrderInfo getModel() {
		if(null==model){
			model=new OrderInfo();
		}
		return model;
	}

	@Override
	public String index() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String query() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String show() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String create() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	@Action(PATH+"/update")
	public String update() {
		map.put("state",SendService.getInstance().update(model));
		return MAP;
	}

	@Override
	public String delete() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String destroy() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	@Action(PATH+"/{_id}/edit")
	public String edit(){
		super.object=OrderInfoService.getInstance().findOne(_id);
		return EDIT;
	}

	@Override
	@Action(PATH+"/new")
	public String editNew() throws Exception {
		return null;
	}
}
